<?php
require_once DOC_ROOT.'/src/php/Smarty.php';

class PModel{
    private $smarty;
    public function __construct() {
        $this->smarty = PSmarty::getSmarty();
    }

    public function indexAction(){
        $this->display('index.tpl');
    }

    public function display($tpl){
        $this->smarty->display($tpl);
    }

    public function assign($key, $value){
        if(isset($value)){
            $this->smarty->assign($key,$value);
        }else{
            $this->smarty->assign($key);
        }
    }

    public function fetch($tpl){
        return $this->smarty->fetch($tpl);
    }
}